let originalJson = {
    "code": "0",
    "msg": "",
    "userid": "12123",
    "username": "飞的更高",
    "avatars": "http://img.xxxx.com/userinfo/U1231/avatar.png",
    "points": "23200",
    "secret" : "019885114f35238ed38060ec8f86e23daa5083c6"
}

function Sha1Encrypt(json){

    let jsonSort = {}
    let maps = Object.keys(json);

    maps.sort();

    for (let i = 0; i < maps.length; i++) {
      k = maps[i];
      jsonSort[k] = json[k]
    }

    let str = JSON.stringify(jsonSort)

    let base64 = Buffer.from(str).toString('base64') + "41274cf8d2196bbc4c65d445ea6e15d5"

    let shasum = require('crypto').createHash('sha1');
    shasum.update(base64);
    
    let secret = shasum.digest('hex');

    console.log(str);
    console.log(base64);
    console.log(secret);

    return secret
}

console.log(Sha1Encrypt(originalJson));